package com.baizhi.mall.controller;


import com.baizhi.mall.entity.mysql.BzAttrGroupDO;
import com.baizhi.mall.service.IBzAttrGroupService;
import com.baizhi.mall.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 属性分组 前端控制器
 * </p>
 *
 * @author zhw
 * @since 2021-05-17
 */
@RestController
public class BzAttrGroupController {
    @Autowired
    private IBzAttrGroupService as;
    @GetMapping("/attrGroupAll")
    public ResultEntity<List<BzAttrGroupDO>> selectTree(){
        List<BzAttrGroupDO>list=as.list();
        return ResultEntity.ok(list);
    }
    @PostMapping("attrGroupIns")
    public ResultEntity<String> insert(@RequestBody BzAttrGroupDO attrGroup){
        as.save(attrGroup);
        return ResultEntity.ok();
    }
    @DeleteMapping("/attrGroupDel/{attrGorupId}")
    public ResultEntity<String>delete(@PathVariable("attrGroupId")Integer attrGroupId){
        as.removeById(attrGroupId);
        return ResultEntity.ok();
    }
    @PutMapping("/attrGroupUpd")
    public ResultEntity<String>update(@RequestBody BzAttrGroupDO attrGorup){
        as.updateById(attrGorup);
        return ResultEntity.ok();
    }
}

